package com.haiyou.dc.aggregate.linklist.test;

public abstract class MyAbstractCollection<E> {

    public abstract Object[] iterator();

    @Override
    public String toString() {
        Object[] iterator = iterator();
        if (iterator == null || iterator.length <= 0) {
            return "[]";
        }
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0, size = iterator.length; i < size; i++) {
            if (i != 0) {
                sb.append(", ");
            }
            sb.append(iterator[i]);
        }
        return sb.append("]").toString();
    }
}
